<?php

class CustStockIn extends AppModel {
    var $name = 'CustStockIn';

    var $useTable = 'cust_stocks_in';

    const ITS_STOCK_OUT_TYPE = 'S';

    const CUST_STOCK_IN_TYPE = 'S';

    var $belongsTo = array('Product', 'CustProductSite',
            'DispatchStatus' => array(
                'fields' => array('id', 'title')
        ),
    );

    var $validate = array(
        'deliver_qty' => array(
            'rule' => 'numeric',
            'message' => 'Please input deliver quantity',
            'on' => 'create'
        ),
    );


    function beforeSave() {
        if (isset($this->data['CustStockIn']['replenish_date'])) {
            $this->data['CustStockIn']['replenish_date'] = $this->dateFormatBeforeSave($this->data['CustStockIn']['replenish_date']);
        }
        return true;
    }
}
?>
